<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <!--
      If you are serving your web app in a path other than the root, change the
      href value below to reflect the base path you are serving from.

      The path provided below has to start and end with a slash "/" in order for
      it to work correctly.

      For more details:
      * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
    -->
    <base href="/kjjf/">

    <meta charset="UTF-8">
    <meta content="IE=Edge" http-equiv="X-UA-Compatible">
    <meta name="description" content="A new Flutter project.">

    <!-- iOS meta tags & icons -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="康居缴费">
    <link rel="apple-touch-icon" href="icons/Icon-192.png">
    <link rel="stylesheet" type="text/css" href="styles.css">
    <title>康居缴费</title>
    <link rel="manifest" href="manifest.json">
    <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js" charset="utf-8" ></script>

</head>
<body>
<div class="center">
    <div class="sk-chase">
        <div class="sk-chase-dot"></div>
        <div class="sk-chase-dot"></div>
        <div class="sk-chase-dot"></div>
        <div class="sk-chase-dot"></div>
        <div class="sk-chase-dot"></div>
        <div class="sk-chase-dot"></div>
    </div>
</div>

<div id="userphone" th:value="${phone}" hidden></div>
<div id="orderNo" th:value="${orderNo}" hidden></div>
<div id="openid" th:value="${openid}" hidden></div>
<!-- This script installs service_worker.js to provide PWA functionality to
     application. For more information, see:
     https://developers.google.com/web/fundamentals/primers/service-workers -->
<!--      var v = [[${phone}]];-->
<!--var v = "13957718741";-->
<script type="text/javascript">
    window.flutterWebRenderer = "html";
    var v = document.getElementById("userphone").getAttribute("value");
    var openid = document.getElementById("openid").getAttribute("value");
    var orderNo = document.getElementById("orderNo").getAttribute("value");
    if (typeof(Storage) !== "undefined") {
        if (typeof(v) !== "undefined") {
            console.log("333");
            localStorage.kjjfUserPhone=v;
            localStorage.kjjfOpenid=openid;
            localStorage.kjjforderNo=orderNo;
            // 针对 localStorage/sessionStorage 的代码
        } else {
            if (typeof(localStorage.getItem("kjjfUserPhone")) !== "undefined"){
                v = localStorage.kjjfUserPhone;
                openid = localStorage.kjjfOpenid;
                orderNo = localStorage.kjjforderNo;
            }else{
                v = "";
                openid = "";
                orderNo = "";
            }
            // 抱歉！不支持 Web Storage ..
        }

        // 针对 localStorage/sessionStorage 的代码
    } else {
        // 抱歉！不支持 Web Storage ..
    }
    function getPhones() {
        return v;
    }

    function getOpenid() {
        return openid;
    }

    function getOrderNo() {
        return orderNo;
    }

    function onBridgeReady(appId, timeStamp, nonceStr, package2, signType, paySign) {
        var timeStampString = timeStamp.toString();
        WeixinJSBridge.invoke(
            'getBrandWCPayRequest', {
                "appId": appId,
                "timeStamp": timeStampString,
                "nonceStr": nonceStr,
                "package": package2,
                "signType": signType,
                "paySign": paySign
            },
            function(res) {
                if (res.err_msg == "get_brand_wcpay_request:ok") {
                    // 在用户支付成功后执行的操作
                    // Flutter中通过Dart调用JavaScript函数进行交互
                    window.dartCallbackFunction(true); // 通过回调函数通知Flutter支付成功
                }
            }
        );
    }
</script>
<script>
    function reloadF(){
        let urlA = location.href.indexOf('phone=');
        // let urlB = location.href.indexOf('ver=')
        if(urlA != "-1"){
            window.location.href = "https://kangju.0577tx.com/api/wechat/auth?phone="+phone;
            console.log("这是url参数包含a执行");
        }
    }

    // if(urlB != "-1"){
    //     console.log("这是url参数包含b执行")
    // }

</script>


<script src="main36.dart.js" type="application/javascript"></script>
</body>
</html>
